<include file="__THEME__/header" />
<link href="../Public/style.css" rel="stylesheet" type="text/css" />

<!-- 内容 begin  -->
<div class="content">
	<include file="__THEME__/banner" />
	<include file="__THEME__/apps_wide" />
	<div class="main">
		<script type="text/javascript" src="../Public/Js/Common.js" ></script>
		<link href="__PUBLIC__/js/pagination/pagination.css" rel="stylesheet" type="text/css" />
		
		<div class="intro">
			<h2>请标注或输入您使用过的药物，以记录用药过程。</h2>
			<div class="tips">分享给其他病友做参考，同时还可以获知其他病友使用该药物的统计数据！</div>
		</div>
		
		<div class="tools">
			<h2>根据您加入的病友社区提供的药物名称</h2>
			<form method="post">
				<div class="field">
				<label>疾病类别：</label>
					<select name="categoryid" class="select" id="category">
						<volist name="categoryList" id="category">
							<option value="{$category['id']}" <eq name="gcid" value="$category['id']">selected</eq> >
								{$category['title']}
							</option>
						</volist>
					</select>
				</div>
				<div class="field">
					您使用过的药物：
				</div>
				<div class="box">
					<div id="medicinebox">
					</div>
					<div class="c"></div>
					<div class="control">
						<span class="add">没有我使用的药物？<a class="add-btn" href="#" onclick="winMedicine();return false;">+ 我要添加</a></span>
						<span class="more"><a href="#">更多药物&nbsp;&rsaquo;&rsaquo;</a></span>
					</div>
				</div>
				<center><input type="submit" class="sub-btn" value="提交"  /></center>
			</form>
		</div>
		
		<input id="page" type="hidden" value="{$_GET['p']}">
	</div>
	<div class="c"></div>
</div>
<!-- 内容 end -->

<script type="text/javascript">
	$(function(){
		$("#category").change(function(){
			
			var categoryid = $(this).val();
	        $.post(APP+"/Index/getMedicineByCategoryId",{categoryid:categoryid},function(json){
	        	var json = eval("("+json+")");
	        	// alert(json.data);return false;
	            if(json.status == 1){
	            	$("#medicinebox").empty();
	            	$.each(json.data,function(key,value){
	            		$("#medicinebox").append(
	            			'<label><input type="checkbox" name="medicines[]" value='+key+' />'+value+'</label>'
	            		);
	            	});
	            }else{
					$("#medicinebox").html('<center>对不起，暂时还没有相关数据！<center>');
	            }
	        });		
			$('#'+type).show();
			$('#'+type).find("input").removeAttr("disabled");
		});
		
		$("#category").find("option[value={$gcid}]").attr("selected",true);
		$('#category').triggerHandler('change');
	});
	
	function winMedicine() {
		var categoryid = $("#category").children("option:selected").val();
		ymPrompt.win(APP+'/Index/addMedicine/categoryid/'+categoryid,350,200,'添加药物',null,null,null,{id:'a'})
	}
	

</script>


<include file="__THEME__/footer" />

